xen: sched_credit: let the scheduler know about node-affinity
authorDario Faggioli <dario.faggioli@citrix.com>
Wed, 17 Apr 2013 10:57:31 +0000 (10:57 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 17 Apr 2013 11:11:14 +0000 (12:11 +0100)
commitcfcc144ff1ce59a9f93a44bbc89d1e20f5011c3d
tree2ff4399fd7c4a001353e2adc9c9c70736a645d1b
parentebb064aa22715ae473f72468d093e7a05e3c3c58
xen: sched_credit: let the scheduler know about node-affinity

As vcpu-affinity tells where VCPUs must run, node-affinity tells
where they prefer to. While respecting vcpu-affinity remains mandatory,
node-affinity is not that strict, it only expresses a preference,
although honouring it will bring significant performance benefits
(especially as compared to not having any affinity at all).

This change modifies the VCPUs load balancing algorithm (for the
credit scheduler only), introducing a two steps logic. During the
first step, we use both the vcpu-affinity and the node-affinity
masks (by looking at their intersection). The aim is giving precedence
to the PCPUs where the domain prefers to run, as expressed by its
node-affinity (with the intersection with the vcpu-afinity being
necessary in order to avoid running a VCPU where it never should).
If that fails in finding a valid PCPU, the node-affinity is just
ignored and, in the second step, we fall back to using cpu-affinity
only.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/common/sched_credit.c
xen/include/xen/nodemask.h